/**
 * @author Tobias Boehm
 *
 * 13.04.2011
 */
package org.anddev.andengine.extension.tbsengine.faction;

import java.io.IOException;

import org.anddev.andengine.extension.tbsengine.shared.IImageOrTextSelectableItem;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;

/**
 * This class is the abstract description of a base faction class which should 
 * be extended by specific faction classes.
 *
 * @author Tobias Boehm
 *
 */
public abstract class AbsBaseFaction implements IImageOrTextSelectableItem {
	
	/**
	 * The name of this faction.
	 */
	protected final String mName;
	
	/**
	 * The menu-icon of this faction for representing this faction in-game.
	 */
	protected Drawable mMenuIcon;
	
	protected final Context mContext;
					
	protected AbsBaseFaction(final Context pContext) throws IOException{
				
		this.mContext = pContext;
		
		this.mName = this.initName();
			
		this.mMenuIcon = BitmapDrawable.createFromStream(pContext.getAssets().open(this.initMenuIconPath()), this.initMenuIconPath());
	}
	
	/**
	 * @return the mName
	 */
	public String getName() {
		return mName;
	}
	
	
	/**
	 * @return the mIconSmall
	 */
	public Drawable getMenuIcon() {
		return this.mMenuIcon;
	}

	/**
	 * This method should provide the specific faction name.
	 * 
	 * @return
	 */
	protected abstract String initName();
	
	/**
	 * This method should provide a path to a menu-icon in the asset directory.
	 *  
	 * <br>For example: <code>gfx/factions/icons/stato_utopia_icon_small.png</code>
	 * 
	 * @return
	 */
	protected abstract String initMenuIconPath();
	
	/**
	 * This method should provide a specific language independent faction-id.
	 * 
	 * @return
	 */
	public abstract String getFactionIDname();
}
